﻿@{
    @using lso_2u_Web应用开发.Models;
    SessionHelper sessionHelper = new SessionHelper();

}
<!DOCTYPE html>

<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>@(ViewBag.Title ?? "服饰工艺业务管理系统")</title>

    <link rel="stylesheet" href="~/css/public.css">
    <script src="~/js/bulma_navbar.js"></script>
    <script src="~/js/jquery.min.js"></script>
    <style>
        html,
        body {
            width: 100%;
            height: 100%;
            margin: 0;
            padding: 0;
        }

        #head_contain {
            height: 55px;
        }
    </style>


    @{
        if (!string.IsNullOrEmpty(ViewBag.Msg))
        {
            <script>
                alert("@ViewBag.Msg");
            </script>
        }
    }
</head>

<body>
    <nav class="navbar has-shadow" id="head_contain">
        <div class="navbar-brand">
            <a class="navbar-item" href="/">
                <img src="~/img/logo.png" height="28" />
            </a>
            <a role="button" class="navbar-burger" data-target="menu_toggle">
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
                <span aria-hidden="true"></span>
            </a>
        </div>

        <div class="navbar-menu" id="menu_toggle">
            <div class="navbar-start">
                <!-- 未登录状态 -->
                @{
                    if (!sessionHelper.IsLogined)
                    {
                        <a class="navbar-item" href="/User/LoginByCode">
                            分享码登录
                        </a>
                    }
                }
            </div>

            <div class="navbar-end">
                <!-- 已登录状态 -->
                @{
                    if (sessionHelper.IsLogined)
                    {
                        <div class="navbar-item has-dropdown is-hoverable" style="margin-right: 12px">
                            <a class="navbar-link ">
                                @await Component.InvokeAsync("UserAvatarInfo")
                            </a>

                            <div class="navbar-dropdown">
                                <a class="navbar-item">
                                    个人信息
                                </a>
                                <a class="navbar-item">
                                    安全中心
                                </a>
                                <hr class="navbar-divider">
                                <a class="navbar-item" href="/User/Logout">
                                    退出登录
                                </a>
                            </div>
                        </div>
                    }
                }

                <!-- 未登录状态 -->
                @{
                    if (!sessionHelper.IsLogined)
                    {
                        <div class="navbar-item">
                            <div class="buttons">
                                <a class="button is-primary" href="/User/Register">
                                    <strong>注册</strong>
                                </a>
                                <a class="button is-light" href="/User/Login" style="margin-left: 12px;">
                                    登录
                                </a>
                            </div>
                        </div>
                    }
                }
            </div>
        </div>
    </nav>

    @RenderBody()

</body>

</html>